﻿<UserControl x:Class="WorkSpace.UI.Controls.CategoryListPart"
            xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
            xmlns:ss="clr-namespace:SmartSpace.UI.Silverlight;assembly=SmartSpace.UI.Silverlight"
            xmlns:src="clr-namespace:WorkSpace.UI.Controls"
            mc:Ignorable="d"
            d:DesignHeight="300" 
            d:DesignWidth="600">
    <UserControl.Resources>
        <src:EnableVisibilityConverter x:Key="EnableVisibilityConverter"/>
        <src:DisableVisibilityConverter x:Key="DisableVisibilityConverter"/>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <ss:SlToolbar Grid.Row="0">
                <Button Name="_ctlBtnCreate" Content="添加类别" Click="_ctlBtnCreate_Click" Width="75" Height="25" Margin="5,5,0,5"/>
                <Button Name="_ctlBtnUpdate" Content="修改类别" Width="75" Height="25" Margin="5,5,0,5"/>
                <Button Name="_ctlBtnDelete" Content="删除类别" Width="75" Height="25" Margin="5,5,5,5"/>
        </ss:SlToolbar>
        <sdk:DataGrid Name="_ctlGrid" Grid.Row="1" AutoGenerateColumns="False" IsReadOnly="True" SelectionChanged="_ctlGrid_SelectionChanged">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn Header="名称" Binding="{Binding Path=Caption}"/>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
        </Grid>
        <Grid Grid.Column="1" Margin="5,0,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <ss:SlToolbar Grid.Row="0">
                <Button Name="_ctlBtnCreateLink" Content="添加连接" Click="_ctlBtnCreateLink_Click" Width="75" Height="25" Margin="5,5,0,5" />
                <Button Name="_ctlBtnUpdateLink" Content="修改连接" Width="75" Height="25" Margin="5,5,0,5"/>
                <Button Name="_ctlBtnDeleteLink" Content="删除连接" Width="75" Height="25" Margin="5,5,5,5"/>
            </ss:SlToolbar>
            <sdk:DataGrid Name="_ctlGridLink" Grid.Row="1" AutoGenerateColumns="False" IsReadOnly="True">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Header="名称" Binding="{Binding Path=Caption}"/>
                    <sdk:DataGridTextColumn Header="地址" Binding="{Binding Path=LinkUrl}"/>
                    <sdk:DataGridTemplateColumn Header="设置">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <HyperlinkButton Click="HyperlinkButton_Click" Visibility="{Binding Path=IsEnable, Converter={StaticResource EnableVisibilityConverter}}">
                                        <TextBlock Text="启用"/>
                                    </HyperlinkButton>
                                    <HyperlinkButton Click="ButtonDisable_Click" Visibility="{Binding Path=IsEnable, Converter={StaticResource DisableVisibilityConverter}}">
                                        <TextBlock Text="禁用"/>
                                    </HyperlinkButton>
                                </StackPanel>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </Grid>
    </Grid>
</UserControl>